/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package UTILITARIOS;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Administrador
 */
public class StringToDate {

    public Date convertir(String fecha)
    {
        Date res= new Date();
        DateFormat df = new SimpleDateFormat("yyyy/MM/dd");

        try
            {
            res = df.parse(fecha);
        //System.out.println("Today = " + df.format(res));
            }           catch (ParseException e){
                            e.printStackTrace();
                            }

        return res;
    }


    public String dateAstring(Date fecha)
    {
        String res ="";

        SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");

        res = df.format(fecha);

        return res;

    }

    public static void main(String args[])
    {
        StringToDate to = new StringToDate();

        Date re =  to.convertir("14-08-2010");
        System.out.println("resultado=="+re);
    }

}
